//
//  RouteData.m
//  GeoData
//
//  Created by zhenhua zhou on 12-7-7.
//  Copyright (c) 2012年 ECUST. All rights reserved.
//

#import "RouteData.h"

@implementation RouteData

@synthesize Segments, MaxPos, MinPos;

- (RouteData *) init
{
    self = [super init];
    if(self)
    {
        Segments = [[NSMutableArray alloc] init];
        
        if(MaxPos==nil)
        {
            MaxPos = [[GeoPos alloc]init];
        }
        if(MinPos==nil)
        {
            MinPos = [[GeoPos alloc]init];
        }
        
    }
    
    return self;
}

- (void) dealloc
{
    if(Segments)
    {
        [Segments removeAllObjects];
        [Segments dealloc];
    }
    
    [super dealloc];
}

- (void) addSegment:(Segment *)obj
{
    if(Segments == nil)
    {
        Segments = [[NSMutableArray alloc] init];
    }
    
    [Segments addObject:obj];
}

- (void) insertSegment:(Segment *)obj atIndex:(int32_t)index
{
    if(Segments == nil)
    {
        Segments = [[NSMutableArray alloc] init];
    }
    
    [Segments insertObject:obj atIndex:index];
}

@end
